package cn.huiyunche.base.service.interfaces.impl;

import cn.huiyunche.base.service.constant.QiniuConstant;
import cn.huiyunche.base.service.framework.utils.HYCUtils;
import cn.huiyunche.base.service.framework.utils.QiniuUtils;
import cn.huiyunche.base.service.interfaces.BTrailerTypeService;
import cn.huiyunche.base.service.mappers.BTrailerTypeMapper;
import cn.huiyunche.base.service.model.BTrailerType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @FileName: cn.huiyunche.app.service.interfaces.impl
 * @Description: Description
 * @author: Aaron
 * @date: 2016/11/16 上午10:49
 */
@Service
public class BTrailerTypeServiceImpl implements BTrailerTypeService {

//    private static final Logger LOGGER = LoggerFactory.getLogger(BTrailerTypeServiceImpl.class);

    @Autowired
    private BTrailerTypeMapper bTrailerTypeMapper;

    @Override
    public List<BTrailerType> getList() {
        List<BTrailerType> list = bTrailerTypeMapper.selectByExample(null);
        list.stream().forEach(trailer -> {
                    trailer.setSelectedLogo(QiniuUtils.generateDownloadTicket(HYCUtils.getConstantPropertiesLoader().getProperty(QiniuConstant.QINIU_LOGO_BUCKET),
                            trailer.getSelectedLogo(), "", "", ""));
                    trailer.setUnselectedLogo(QiniuUtils.generateDownloadTicket(HYCUtils.getConstantPropertiesLoader().getProperty(QiniuConstant.QINIU_LOGO_BUCKET),
                            trailer.getUnselectedLogo(), "", "", ""));
                }
        );
        return list;
    }
}
